<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="/WEB-INF/c.tld" %>
<%@ taglib prefix="fmt" uri="/WEB-INF/fmt.tld" %>
<form action="${contextPath }/admin/product/update.do" method="post" enctype="multipart/form-data">
	<table>
		<CAPTION>上传产品</CAPTION>
		<tbody>
			
			<tr>
				<td>产品名称</td>
				<td><input name="product.productName" value="${obj.product.productName}"/>
					<input name="product.id" value="${obj.product.id }" type="hidden"/>
					<input name="product.vendorid" value="${obj.product.vendorid }" type="hidden"/>
				</td>
			</tr>
			<tr>
				<td>产品分类</td><td>
					<select name="product.classifyid">
						<c:forEach items="${obj.classifys}" var="c">
							<c:if test="${c.parentid==0}">
								<optgroup label="${c.classifyName}" ></optgroup>
								<c:forEach items="${obj.classifys}" var="cc">
									<c:if test="${cc.parentid == c.id}">
										<c:if test="${cc.id == obj.product.classifyid}">
											<option value="${cc.id}" selected="selected">|_${cc.classifyName }</option>
										</c:if>
										<c:if test="${cc.id != obj.product.classifyid}">
											<option value="${cc.id}" >|_${cc.classifyName }</option>
										</c:if>
									</c:if>
								</c:forEach>
							</c:if>
						</c:forEach>
					</select>
				</td>
			</tr>
			<tr>
				<td>产品功能</td><td>
				<select name="product.brandid">
					<c:forEach items="${obj.brands}" var="b">
						<c:if test="${b.id==obj.product.brandid}">
							<option value="${b.id }" selected="selected">${b.brandName }</option>
						</c:if>
						<c:if test="${b.id!=obj.product.brandid}">
							<option value="${b.id }">${b.brandName }</option>
						</c:if>
					</c:forEach>
				</select>
				</td>
			</tr>
			<tr>
				<td>图片预览</td><td>
				<input name="product.image" value="${obj.product.image }" type="hidden"/>
				<img width="100px" height="100px" src="${contextPath}${obj.product.image}"/></td>
			</tr>
			<tr>
				<td>产品图片</td><td><input type="file" name="image"/>(gif,jpg,png格式，400*400)</td>
			</tr>
			<tr>
				<td>产品价格</td><td><input name="product.price" value="${obj.product.price}"/></td>
			</tr>
			<tr>
				<td>是否促销</td><td>
				<c:if test="${obj.product.ifPromotion}">
					<input type="checkbox" value="true" checked="checked" name="product.ifPromotion"/>
				</c:if>
				<c:if test="${!obj.product.ifPromotion}">
					<input type="checkbox" value="true" name="product.ifPromotion"/>
				</c:if>
				</td>
			</tr>
			<tr>
				<td>促销价格</td><td><input name="product.promotionPrice" value="${obj.product.promotionPrice }"/></td>
			</tr>
			<tr>
				<td>是否推荐</td><td>
				<c:if test="${obj.product.ifRecommend}">
					<input type="checkbox" value="true" checked="checked" name="product.ifRecommend"/>
				</c:if>
				<c:if test="${!obj.product.ifRecommend}">
					<input type="checkbox" value="true" name="product.ifRecommend"/>
				</c:if>
				</td>
			</tr>
			<tr>
				<td>产品状态</td><td>
					<select name="product.state">
						<c:if test="${obj.product.state==0}">
						<option value="1">上架</option>
						<option value="0" selected="selected">下架</option>
						</c:if>
						<c:if test="${obj.product.state==1}">
						<option value="1" selected="selected">上架</option>
						<option value="0">下架</option>
						</c:if>
					</select>
				</td>
			</tr>
			<tr>
				<td>产品介绍</td><td><textarea id="product-description" cols="80" rows="30" name="product.description">${obj.product.description }</textarea></td>
			</tr>
			<tr>
				<td></td><td><button type="submit">保存修改</button></td>
			</tr>
		</tbody>
	</table>
</form>
<script src="${contextPath }/kindeditor/kindeditor-min.js" type="text/javascript"></script>
<script type="text/javascript">
KE.show({
	id:"product-description"
});
</script>